﻿Module modStrings
    Public Function String_Between(ByRef stringText As String, ByVal stringBefore As String,
                                   Optional ByVal stringAfter As String = Nothing) As String

        Dim _start As Integer
        Dim _length As Integer

        If stringAfter = Nothing Then

            stringAfter = stringBefore

        End If

        _start = stringText.IndexOf(stringBefore, StringComparison.Ordinal) + stringBefore.Length
        _length = stringText.Substring(_start).IndexOf(stringAfter, StringComparison.Ordinal)

        Return stringText.Substring(_start, _length)
    End Function
End Module